
package patchy;

import static com.sun.org.apache.xalan.internal.lib.ExsltDatetime.date;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerDateModel;


public class MainFrame extends JFrame implements Runnable {
    
    private Root root = new Root().inputData();
    private DefaultListModel listModelEvents = new DefaultListModel();
    private DefaultListModel listModelCourse = new DefaultListModel();
    private DefaultListModel listModelArchive = new DefaultListModel();
    private ArrayList<Course> courses = new ArrayList<>(); 
    private ObjectOutputStream fileWrite = null;
    private Object[][] courseTable = new Object[root.getCourses().size()][5];
    private boolean alert = false;
    private int alarmHour;
    private int alarmMinute;
    private int eventHour;
    private int eventMinute;

    public MainFrame() {
        initHome();
        initComponents();
        init();
    }
    
    private void init() {
        setTitle("Patchy");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(900,560);
        setLocationRelativeTo(null);
        setVisible(true);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        addEventFrame = new javax.swing.JFrame();
        addEventPanel = new javax.swing.JPanel();
        eventTitle = new javax.swing.JLabel();
        eventTitleText = new javax.swing.JTextField();
        eventFrom = new javax.swing.JLabel();
        eventTo = new javax.swing.JLabel();
        eventDate = new javax.swing.JLabel();
        eventDatePicker = new com.toedter.calendar.JDateChooser();
        eventCourse = new javax.swing.JLabel();
        eventCoursePicker = new javax.swing.JComboBox();
        eventAlarm = new javax.swing.JLabel();
        eventDescription = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        eventDescriptionArea = new javax.swing.JTextArea();
        cancelEventButton = new javax.swing.JButton();
        adderEventButton = new javax.swing.JButton();
        timeFrom = new lu.tudor.santec.jtimechooser.JTimeChooser();
        timeTo = new lu.tudor.santec.jtimechooser.JTimeChooser();
        timeAlarm = new lu.tudor.santec.jtimechooser.JTimeChooser();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        editEventFrame = new javax.swing.JFrame();
        addEventPanel1 = new javax.swing.JPanel();
        eventTitle1 = new javax.swing.JLabel();
        eventTitleText1 = new javax.swing.JTextField();
        eventFrom1 = new javax.swing.JLabel();
        eventTo1 = new javax.swing.JLabel();
        eventDate1 = new javax.swing.JLabel();
        eventDatePicker1 = new com.toedter.calendar.JDateChooser();
        eventCourse1 = new javax.swing.JLabel();
        eventCoursePicker1 = new javax.swing.JComboBox();
        eventAlarm1 = new javax.swing.JLabel();
        eventDescription1 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        eventDescriptionArea1 = new javax.swing.JTextArea();
        cancelEventButton1 = new javax.swing.JButton();
        saveEditEventButton = new javax.swing.JButton();
        timeFrom1 = new lu.tudor.santec.jtimechooser.JTimeChooser();
        timeTo1 = new lu.tudor.santec.jtimechooser.JTimeChooser();
        timeAlarm1 = new lu.tudor.santec.jtimechooser.JTimeChooser();
        jLabel21 = new javax.swing.JLabel();
        viewEventFrame = new javax.swing.JFrame();
        viewEventPanel = new javax.swing.JPanel();
        viewTitleLabel = new javax.swing.JLabel();
        viewFromLabel = new javax.swing.JLabel();
        viewToLabel = new javax.swing.JLabel();
        viewCourseLabel = new javax.swing.JLabel();
        viewDateLabel = new javax.swing.JLabel();
        viewTextField = new javax.swing.JTextField();
        closeViewEvent = new javax.swing.JButton();
        editViewEvent = new javax.swing.JButton();
        viewAlarmLabel = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        viewArchiveEventFrame = new javax.swing.JFrame();
        viewEventPanel1 = new javax.swing.JPanel();
        viewTitleLabel1 = new javax.swing.JLabel();
        viewFromLabel1 = new javax.swing.JLabel();
        viewToLabel1 = new javax.swing.JLabel();
        viewCourseLabel1 = new javax.swing.JLabel();
        viewDateLabel1 = new javax.swing.JLabel();
        closeViewEvent1 = new javax.swing.JButton();
        viewTextField1 = new javax.swing.JTextField();
        viewAlarmLabel1 = new javax.swing.JLabel();
        viewScoreLabel = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        addCourseFrame = new javax.swing.JFrame();
        addCoursePanel = new javax.swing.JPanel();
        courseTitle = new javax.swing.JLabel();
        courseDescriptiveTitle = new javax.swing.JTextField();
        courseFrom = new javax.swing.JLabel();
        courseTo = new javax.swing.JLabel();
        courseDays = new javax.swing.JLabel();
        course = new javax.swing.JLabel();
        cancelCourseButton = new javax.swing.JButton();
        adderCourseButton = new javax.swing.JButton();
        courseTitleBox = new javax.swing.JTextField();
        courseDaysPicker = new javax.swing.JSpinner();
        courseTimeFrom = new lu.tudor.santec.jtimechooser.JTimeChooser();
        courseTimeTo = new lu.tudor.santec.jtimechooser.JTimeChooser();
        jLabel38 = new javax.swing.JLabel();
        editCourseFrame = new javax.swing.JFrame();
        addCoursePanel1 = new javax.swing.JPanel();
        courseTitle1 = new javax.swing.JLabel();
        courseDescriptiveTitle1 = new javax.swing.JTextField();
        courseFrom1 = new javax.swing.JLabel();
        courseTo1 = new javax.swing.JLabel();
        courseDays1 = new javax.swing.JLabel();
        course1 = new javax.swing.JLabel();
        cancelCourseButton1 = new javax.swing.JButton();
        courseEditSave = new javax.swing.JButton();
        courseTitleBox1 = new javax.swing.JTextField();
        courseDaysPicker1 = new javax.swing.JSpinner();
        courseTimeFrom1 = new lu.tudor.santec.jtimechooser.JTimeChooser();
        courseTimeTo1 = new lu.tudor.santec.jtimechooser.JTimeChooser();
        jLabel39 = new javax.swing.JLabel();
        setScoreFrame = new javax.swing.JFrame();
        setScorePanel = new javax.swing.JPanel();
        cancelScoreButton = new javax.swing.JButton();
        setScoreButton = new javax.swing.JButton();
        scoreLabel = new javax.swing.JLabel();
        maxScoreLabel = new javax.swing.JLabel();
        scoreTextField = new javax.swing.JTextField();
        maxScoreTextField = new javax.swing.JTextField();
        jLabel40 = new javax.swing.JLabel();
        alarmDialog = new javax.swing.JDialog();
        jPanel1 = new javax.swing.JPanel();
        alarmTitle = new javax.swing.JLabel();
        alarmTime = new javax.swing.JLabel();
        alarmTimeFrom = new javax.swing.JLabel();
        alarmClose = new javax.swing.JButton();
        jLabel41 = new javax.swing.JLabel();
        mainPanel = new javax.swing.JPanel();
        topPanel = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        leftPanel = new javax.swing.JPanel();
        eventsButtonsPanel = new javax.swing.JPanel();
        addEventButton = new javax.swing.JButton();
        editEventButton = new javax.swing.JButton();
        viewEventButton = new javax.swing.JButton();
        deleteEventButton = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        coursesButtonsPanel = new javax.swing.JPanel();
        addCourseButton = new javax.swing.JButton();
        editCourseButton = new javax.swing.JButton();
        deleteCourseButton = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        archiveButtonsPanel = new javax.swing.JPanel();
        viewEventArchiveButton = new javax.swing.JButton();
        deleteEventArchiveButton = new javax.swing.JButton();
        setScoreArchiveButton = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        rightPanel = new javax.swing.JPanel();
        eventsButton = new javax.swing.JButton();
        coursesButton = new javax.swing.JButton();
        archiveButton = new javax.swing.JButton();
        centerPanelCourse = new javax.swing.JPanel();
        activityPanel = new javax.swing.JPanel();
        eventsPanel = new javax.swing.JPanel();
        jCalendar1 = new com.toedter.calendar.JCalendar();
        listPane = new javax.swing.JScrollPane();
        todayList = new javax.swing.JList(listModelEvents);
        upcomingEventsLabel = new javax.swing.JLabel();
        coursesPanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        coursePane = new javax.swing.JScrollPane();
        courseList = new javax.swing.JList(listModelCourse);
        archivePanel = new javax.swing.JPanel();
        archivePane = new javax.swing.JScrollPane();
        archiveList = new javax.swing.JList(listModelArchive);
        jLabel2 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();

        addEventFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addEventFrame.setResizable(false);
        addEventFrame.getContentPane().setLayout(null);

        eventTitle.setText("Title:");

        eventFrom.setText("From:");

        eventTo.setText("To:");

        eventDate.setText("Date:");

        eventDatePicker.setDateFormatString("MM/dd/yy");

        eventCourse.setText("Course:");

        eventCoursePicker.setModel(new javax.swing.DefaultComboBoxModel(courses.toArray()));

        eventAlarm.setText("Alarm:");

        eventDescription.setText("Description:");

        eventDescriptionArea.setColumns(20);
        eventDescriptionArea.setRows(5);
        jScrollPane4.setViewportView(eventDescriptionArea);

        cancelEventButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/CANCEL.png"))); // NOI18N
        cancelEventButton.setText("Cancel");
        cancelEventButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelEventButtonActionPerformed(evt);
            }
        });

        adderEventButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/add.png"))); // NOI18N
        adderEventButton.setText("Add");
        adderEventButton.setMaximumSize(new java.awt.Dimension(69, 23));
        adderEventButton.setMinimumSize(new java.awt.Dimension(69, 23));
        adderEventButton.setPreferredSize(new java.awt.Dimension(69, 23));
        adderEventButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adderEventButtonActionPerformed(evt);
            }
        });

        jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/ALARM.png"))); // NOI18N

        jLabel19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/componentbg.jpg"))); // NOI18N

        javax.swing.GroupLayout addEventPanelLayout = new javax.swing.GroupLayout(addEventPanel);
        addEventPanel.setLayout(addEventPanelLayout);
        addEventPanelLayout.setHorizontalGroup(
            addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addEventPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addEventPanelLayout.createSequentialGroup()
                        .addComponent(eventAlarm)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(timeAlarm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(eventDescription))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel18)
                .addGap(0, 161, Short.MAX_VALUE))
            .addGroup(addEventPanelLayout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addEventPanelLayout.createSequentialGroup()
                        .addComponent(eventFrom)
                        .addGap(30, 30, 30)
                        .addComponent(timeFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addEventPanelLayout.createSequentialGroup()
                        .addComponent(eventTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(2, 2, 2)
                        .addComponent(eventTitleText, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(4, 4, 4)
                        .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(eventCourse)
                            .addGroup(addEventPanelLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(eventTo)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(addEventPanelLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(timeTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(eventCoursePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(addEventPanelLayout.createSequentialGroup()
                        .addComponent(eventDate)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(eventDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addEventPanelLayout.createSequentialGroup()
                            .addComponent(cancelEventButton, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(adderEventButton, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addEventPanelLayout.createSequentialGroup()
                    .addGap(0, 0, Short.MAX_VALUE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );
        addEventPanelLayout.setVerticalGroup(
            addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addEventPanelLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(eventTitleText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(addEventPanelLayout.createSequentialGroup()
                            .addGap(3, 3, 3)
                            .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(eventCourse, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(eventTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addComponent(eventCoursePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addEventPanelLayout.createSequentialGroup()
                        .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(timeTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(eventTo, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(addEventPanelLayout.createSequentialGroup()
                        .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(eventFrom, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE)
                            .addComponent(timeFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(eventDate, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(eventDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(6, 6, 6)))
                .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addEventPanelLayout.createSequentialGroup()
                        .addComponent(jLabel18)
                        .addGap(9, 9, 9))
                    .addGroup(addEventPanelLayout.createSequentialGroup()
                        .addGap(5, 5, 5)
                        .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(eventAlarm)
                            .addComponent(timeAlarm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(eventDescription)))
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cancelEventButton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(adderEventButton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(44, 44, 44))
            .addGroup(addEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addEventPanelLayout.createSequentialGroup()
                    .addGap(0, 0, Short.MAX_VALUE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 370, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );

        addEventFrame.getContentPane().add(addEventPanel);
        addEventPanel.setBounds(0, 0, 320, 370);

        editEventFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        editEventFrame.setResizable(false);
        editEventFrame.getContentPane().setLayout(null);

        eventTitle1.setText("Title:");

        eventFrom1.setText("From:");

        eventTo1.setText("To:");

        eventDate1.setText("Date:");

        eventDatePicker1.setDateFormatString("MM/dd/yy");

        eventCourse1.setText("Course:");

        eventCoursePicker1.setModel(new javax.swing.DefaultComboBoxModel(courses.toArray()));

        eventAlarm1.setText("Alarm:");

        eventDescription1.setText("Description:");

        eventDescriptionArea1.setColumns(20);
        eventDescriptionArea1.setRows(5);
        jScrollPane5.setViewportView(eventDescriptionArea1);

        cancelEventButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/CANCEL.png"))); // NOI18N
        cancelEventButton1.setText("Cancel");
        cancelEventButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelEventButton1ActionPerformed(evt);
            }
        });

        saveEditEventButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/save.png"))); // NOI18N
        saveEditEventButton.setText("Save");
        saveEditEventButton.setMaximumSize(new java.awt.Dimension(69, 23));
        saveEditEventButton.setMinimumSize(new java.awt.Dimension(69, 23));
        saveEditEventButton.setPreferredSize(new java.awt.Dimension(69, 23));
        saveEditEventButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveEditEventButtonActionPerformed(evt);
            }
        });

        jLabel21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/componentbg.jpg"))); // NOI18N

        javax.swing.GroupLayout addEventPanel1Layout = new javax.swing.GroupLayout(addEventPanel1);
        addEventPanel1.setLayout(addEventPanel1Layout);
        addEventPanel1Layout.setHorizontalGroup(
            addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addEventPanel1Layout.createSequentialGroup()
                .addGap(58, 58, 58)
                .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addEventPanel1Layout.createSequentialGroup()
                        .addComponent(timeAlarm1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(addEventPanel1Layout.createSequentialGroup()
                        .addComponent(timeFrom1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(timeTo1, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(60, 60, 60))))
            .addGroup(addEventPanel1Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(cancelEventButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(saveEditEventButton, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 68, Short.MAX_VALUE))
            .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addEventPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(addEventPanel1Layout.createSequentialGroup()
                            .addComponent(eventTitle1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(2, 2, 2)
                            .addComponent(eventTitleText1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(eventCourse1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(eventCoursePicker1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(addEventPanel1Layout.createSequentialGroup()
                            .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(eventFrom1)
                                .addGroup(addEventPanel1Layout.createSequentialGroup()
                                    .addComponent(eventDate1)
                                    .addGap(8, 8, 8)
                                    .addComponent(eventDatePicker1, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(eventTo1))
                        .addComponent(eventAlarm1)
                        .addComponent(eventDescription1)
                        .addGroup(addEventPanel1Layout.createSequentialGroup()
                            .addGap(10, 10, 10)
                            .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(55, Short.MAX_VALUE)))
            .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addEventPanel1Layout.createSequentialGroup()
                    .addGap(0, 10, Short.MAX_VALUE)
                    .addComponent(jLabel21)
                    .addGap(0, 10, Short.MAX_VALUE)))
        );
        addEventPanel1Layout.setVerticalGroup(
            addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addEventPanel1Layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(timeTo1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(timeFrom1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(50, 50, 50)
                .addComponent(timeAlarm1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 149, Short.MAX_VALUE)
                .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(saveEditEventButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cancelEventButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(71, 71, 71))
            .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addEventPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(eventTitle1)
                        .addComponent(eventTitleText1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(eventCourse1)
                        .addComponent(eventCoursePicker1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(eventFrom1)
                        .addComponent(eventTo1))
                    .addGap(18, 18, 18)
                    .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(eventDate1)
                        .addComponent(eventDatePicker1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addComponent(eventAlarm1)
                    .addGap(18, 18, 18)
                    .addComponent(eventDescription1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(118, Short.MAX_VALUE)))
            .addGroup(addEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addEventPanel1Layout.createSequentialGroup()
                    .addGap(0, 0, Short.MAX_VALUE)
                    .addComponent(jLabel21)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );

        editEventFrame.getContentPane().add(addEventPanel1);
        addEventPanel1.setBounds(0, 0, 350, 380);

        viewEventFrame.setResizable(false);
        viewEventFrame.getContentPane().setLayout(null);

        viewTitleLabel.setText("Title");

        viewFromLabel.setText("TimeFrom");

        viewToLabel.setText("TimeTo");

        viewCourseLabel.setText("Course");

        viewDateLabel.setText("Date");

        viewTextField.setEnabled(false);

        closeViewEvent.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/CANCEL.png"))); // NOI18N
        closeViewEvent.setText("Close");
        closeViewEvent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                closeViewEventActionPerformed(evt);
            }
        });

        editViewEvent.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/edit.png"))); // NOI18N
        editViewEvent.setText("Edit");
        editViewEvent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editViewEventActionPerformed(evt);
            }
        });

        viewAlarmLabel.setText("Alarm");

        jLabel22.setText("EVENT TITLE: ");

        jLabel23.setText("COURSE: ");

        jLabel24.setText("ALARM");

        jLabel25.setText("TIME TO: ");

        jLabel26.setText("TIME FROM: ");

        jLabel27.setText("DATE: ");

        jLabel28.setText("DESCRIPTION: ");

        jLabel29.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/3COMPONENTBG.jpg"))); // NOI18N

        javax.swing.GroupLayout viewEventPanelLayout = new javax.swing.GroupLayout(viewEventPanel);
        viewEventPanel.setLayout(viewEventPanelLayout);
        viewEventPanelLayout.setHorizontalGroup(
            viewEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(viewEventPanelLayout.createSequentialGroup()
                .addGroup(viewEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(108, 108, 108)
                        .addComponent(viewTitleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel23)
                        .addGap(18, 18, 18)
                        .addComponent(viewCourseLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(99, 99, 99)
                        .addComponent(viewFromLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(96, 96, 96)
                        .addComponent(viewToLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(83, 83, 83)
                        .addComponent(viewAlarmLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(31, 31, 31)
                        .addComponent(jLabel28))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(closeViewEvent, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(178, 178, 178)
                        .addComponent(editViewEvent, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel24))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(31, 31, 31)
                        .addComponent(jLabel27))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(93, 93, 93)
                        .addComponent(viewDateLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel22))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(viewTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel26))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel25))
                    .addComponent(jLabel29))
                .addContainerGap())
        );
        viewEventPanelLayout.setVerticalGroup(
            viewEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(viewEventPanelLayout.createSequentialGroup()
                .addGroup(viewEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(60, 60, 60)
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(15, 15, 15)
                        .addComponent(jLabel24)
                        .addGroup(viewEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(viewEventPanelLayout.createSequentialGroup()
                                .addGap(16, 16, 16)
                                .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(viewEventPanelLayout.createSequentialGroup()
                                .addGap(70, 70, 70)
                                .addComponent(viewTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(viewEventPanelLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addGroup(viewEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(viewTitleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(viewEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(viewEventPanelLayout.createSequentialGroup()
                                .addGap(4, 4, 4)
                                .addComponent(viewCourseLabel)))
                        .addGap(14, 14, 14)
                        .addGroup(viewEventPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(viewEventPanelLayout.createSequentialGroup()
                                .addComponent(viewFromLabel)
                                .addGap(6, 6, 6)
                                .addComponent(viewToLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(6, 6, 6)
                                .addComponent(viewAlarmLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(40, 40, 40)
                                .addComponent(jLabel28)
                                .addGap(109, 109, 109)
                                .addComponent(closeViewEvent, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(viewEventPanelLayout.createSequentialGroup()
                                .addGap(87, 87, 87)
                                .addComponent(viewDateLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(143, 143, 143)
                                .addComponent(editViewEvent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(viewEventPanelLayout.createSequentialGroup()
                .addComponent(jLabel29, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        viewEventFrame.getContentPane().add(viewEventPanel);
        viewEventPanel.setBounds(0, 0, 500, 370);

        viewArchiveEventFrame.setResizable(false);
        viewArchiveEventFrame.getContentPane().setLayout(null);

        viewTitleLabel1.setText("Event Title");

        viewFromLabel1.setText("TimeFrom");

        viewToLabel1.setText("TimeTo");

        viewCourseLabel1.setText("Course");

        viewDateLabel1.setText("Date");

        closeViewEvent1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/CANCEL.png"))); // NOI18N
        closeViewEvent1.setText("Close");
        closeViewEvent1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                closeViewEvent1ActionPerformed(evt);
            }
        });

        viewTextField1.setEnabled(false);

        viewAlarmLabel1.setText("Alarm");

        viewScoreLabel.setText("Score");

        jLabel30.setText("EVENT TITLE: ");

        jLabel31.setText("COURSE: ");

        jLabel32.setText("ALARM:");

        jLabel33.setText("TIME TO: ");

        jLabel34.setText("TIME FROM: ");

        jLabel35.setText("DATE: ");

        jLabel36.setText("DESCRIPTION: ");

        jLabel37.setText("SCORE:");

        jLabel20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/4comp.jpg"))); // NOI18N

        javax.swing.GroupLayout viewEventPanel1Layout = new javax.swing.GroupLayout(viewEventPanel1);
        viewEventPanel1.setLayout(viewEventPanel1Layout);
        viewEventPanel1Layout.setHorizontalGroup(
            viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(viewEventPanel1Layout.createSequentialGroup()
                .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel30)
                        .addGap(22, 22, 22)
                        .addComponent(viewTitleLabel1))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel31)
                        .addGap(42, 42, 42)
                        .addComponent(viewCourseLabel1))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel34)
                        .addGap(27, 27, 27)
                        .addComponent(viewFromLabel1))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel33)
                        .addGap(42, 42, 42)
                        .addComponent(viewToLabel1))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel32)
                            .addComponent(jLabel37))
                        .addGap(52, 52, 52)
                        .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(viewAlarmLabel1)
                            .addComponent(viewScoreLabel)))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel35))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(31, 31, 31)
                        .addComponent(jLabel36))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(viewTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(120, 120, 120)
                        .addComponent(viewDateLabel1))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(138, 138, 138)
                        .addComponent(closeViewEvent1, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(210, Short.MAX_VALUE))
            .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 500, Short.MAX_VALUE))
        );
        viewEventPanel1Layout.setVerticalGroup(
            viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(viewEventPanel1Layout.createSequentialGroup()
                .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(212, 212, 212)
                        .addComponent(viewTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(viewEventPanel1Layout.createSequentialGroup()
                                .addGap(9, 9, 9)
                                .addComponent(viewTitleLabel1)))
                        .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(viewEventPanel1Layout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addComponent(viewCourseLabel1)))
                        .addGap(6, 6, 6)
                        .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel34)
                            .addComponent(viewFromLabel1))
                        .addGap(6, 6, 6)
                        .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(viewEventPanel1Layout.createSequentialGroup()
                                .addGap(4, 4, 4)
                                .addComponent(viewToLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(6, 6, 6)
                        .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(viewEventPanel1Layout.createSequentialGroup()
                                .addGap(20, 20, 20)
                                .addComponent(jLabel37, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(viewEventPanel1Layout.createSequentialGroup()
                                .addComponent(viewAlarmLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, 0)
                                .addComponent(viewScoreLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(9, 9, 9)
                        .addComponent(jLabel35, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(11, 11, 11)
                        .addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(viewEventPanel1Layout.createSequentialGroup()
                        .addGap(160, 160, 160)
                        .addComponent(viewDateLabel1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(closeViewEvent1)
                .addContainerGap(58, Short.MAX_VALUE))
            .addGroup(viewEventPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(viewEventPanel1Layout.createSequentialGroup()
                    .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 381, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 11, Short.MAX_VALUE)))
        );

        viewArchiveEventFrame.getContentPane().add(viewEventPanel1);
        viewEventPanel1.setBounds(0, 0, 500, 370);

        addCourseFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addCourseFrame.setResizable(false);
        addCourseFrame.getContentPane().setLayout(null);

        courseTitle.setText("Title:");

        courseFrom.setText("From:");

        courseTo.setText("To:");

        courseDays.setText("Days:");

        course.setText("Course:");

        cancelCourseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/CANCEL.png"))); // NOI18N
        cancelCourseButton.setText("Cancel");
        cancelCourseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelCourseButtonActionPerformed(evt);
            }
        });

        adderCourseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/add.png"))); // NOI18N
        adderCourseButton.setText("Add");
        adderCourseButton.setMaximumSize(new java.awt.Dimension(69, 23));
        adderCourseButton.setMinimumSize(new java.awt.Dimension(69, 23));
        adderCourseButton.setPreferredSize(new java.awt.Dimension(69, 23));
        adderCourseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adderCourseButtonActionPerformed(evt);
            }
        });

        courseDaysPicker.setModel(new javax.swing.SpinnerListModel(new String[] {"MWF", "TTHS", "MTH", "TF", "WS", "M", "T", "W", "TH", "F", "S"}));
        courseDaysPicker.setToolTipText("");

        jLabel38.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/componentbg.jpg"))); // NOI18N

        javax.swing.GroupLayout addCoursePanelLayout = new javax.swing.GroupLayout(addCoursePanel);
        addCoursePanel.setLayout(addCoursePanelLayout);
        addCoursePanelLayout.setHorizontalGroup(
            addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addCoursePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addCoursePanelLayout.createSequentialGroup()
                        .addComponent(courseFrom)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(courseTimeFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(68, 68, 68)
                        .addComponent(courseTo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(courseTimeTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addCoursePanelLayout.createSequentialGroup()
                        .addComponent(courseTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(courseDescriptiveTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addCoursePanelLayout.createSequentialGroup()
                        .addComponent(course)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(courseTitleBox, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addCoursePanelLayout.createSequentialGroup()
                        .addComponent(courseDays)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(courseDaysPicker, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addCoursePanelLayout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(cancelCourseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(43, 43, 43)
                        .addComponent(adderCourseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(41, Short.MAX_VALUE))
            .addGroup(addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addCoursePanelLayout.createSequentialGroup()
                    .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 322, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );
        addCoursePanelLayout.setVerticalGroup(
            addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addCoursePanelLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(course)
                    .addComponent(courseTitleBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(courseTitle)
                    .addComponent(courseDescriptiveTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(courseFrom)
                        .addComponent(courseTo))
                    .addComponent(courseTimeFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(courseTimeTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(courseDays)
                    .addComponent(courseDaysPicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(adderCourseButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cancelCourseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(96, Short.MAX_VALUE))
            .addGroup(addCoursePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 290, Short.MAX_VALUE))
        );

        addCourseFrame.getContentPane().add(addCoursePanel);
        addCoursePanel.setBounds(0, 0, 320, 290);

        editCourseFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        editCourseFrame.setResizable(false);

        courseTitle1.setText("Title:");

        courseFrom1.setText("From:");

        courseTo1.setText("To:");

        courseDays1.setText("Days:");

        course1.setText("Course:");

        cancelCourseButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/CANCEL.png"))); // NOI18N
        cancelCourseButton1.setText("Cancel");
        cancelCourseButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelCourseButton1ActionPerformed(evt);
            }
        });

        courseEditSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/save.png"))); // NOI18N
        courseEditSave.setText("Save");
        courseEditSave.setMaximumSize(new java.awt.Dimension(69, 23));
        courseEditSave.setMinimumSize(new java.awt.Dimension(69, 23));
        courseEditSave.setPreferredSize(new java.awt.Dimension(69, 23));
        courseEditSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                courseEditSaveActionPerformed(evt);
            }
        });

        courseDaysPicker1.setModel(new javax.swing.SpinnerListModel(new String[] {"MWF", "TTHS", "MTH", "TF", "WS", "M", "T", "W", "TH", "F", "S"}));
        courseDaysPicker1.setToolTipText("");

        jLabel39.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/componentbg.jpg"))); // NOI18N

        javax.swing.GroupLayout addCoursePanel1Layout = new javax.swing.GroupLayout(addCoursePanel1);
        addCoursePanel1.setLayout(addCoursePanel1Layout);
        addCoursePanel1Layout.setHorizontalGroup(
            addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addCoursePanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addCoursePanel1Layout.createSequentialGroup()
                        .addComponent(courseTitle1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(courseDescriptiveTitle1, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addCoursePanel1Layout.createSequentialGroup()
                        .addComponent(course1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(courseTitleBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addCoursePanel1Layout.createSequentialGroup()
                        .addComponent(courseDays1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(courseDaysPicker1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addCoursePanel1Layout.createSequentialGroup()
                        .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(addCoursePanel1Layout.createSequentialGroup()
                                .addComponent(courseFrom1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(courseTimeFrom1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(addCoursePanel1Layout.createSequentialGroup()
                                .addGap(16, 16, 16)
                                .addComponent(cancelCourseButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(30, 30, 30)
                        .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(courseEditSave, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(addCoursePanel1Layout.createSequentialGroup()
                                .addComponent(courseTo1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(courseTimeTo1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(44, Short.MAX_VALUE))
            .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jLabel39, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        addCoursePanel1Layout.setVerticalGroup(
            addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addCoursePanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(course1)
                    .addComponent(courseTitleBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(courseTitle1)
                    .addComponent(courseDescriptiveTitle1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(courseFrom1)
                        .addComponent(courseTo1))
                    .addComponent(courseTimeFrom1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(courseTimeTo1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(courseDays1)
                    .addComponent(courseDaysPicker1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(37, 37, 37)
                .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(courseEditSave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cancelCourseButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(57, Short.MAX_VALUE))
            .addGroup(addCoursePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(addCoursePanel1Layout.createSequentialGroup()
                    .addComponent(jLabel39, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 24, Short.MAX_VALUE)))
        );

        javax.swing.GroupLayout editCourseFrameLayout = new javax.swing.GroupLayout(editCourseFrame.getContentPane());
        editCourseFrame.getContentPane().setLayout(editCourseFrameLayout);
        editCourseFrameLayout.setHorizontalGroup(
            editCourseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(addCoursePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        editCourseFrameLayout.setVerticalGroup(
            editCourseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(addCoursePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        setScoreFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setScoreFrame.setResizable(false);
        setScoreFrame.getContentPane().setLayout(null);

        cancelScoreButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/CANCEL.png"))); // NOI18N
        cancelScoreButton.setText("Cancel");
        cancelScoreButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelScoreButtonActionPerformed(evt);
            }
        });

        setScoreButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/save.png"))); // NOI18N
        setScoreButton.setText("Set");
        setScoreButton.setMaximumSize(new java.awt.Dimension(69, 23));
        setScoreButton.setMinimumSize(new java.awt.Dimension(69, 23));
        setScoreButton.setPreferredSize(new java.awt.Dimension(69, 23));
        setScoreButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                setScoreButtonActionPerformed(evt);
            }
        });

        scoreLabel.setText("Score:");

        maxScoreLabel.setText("Max Score:");

        scoreTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                scoreTextFieldActionPerformed(evt);
            }
        });

        maxScoreTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                maxScoreTextFieldActionPerformed(evt);
            }
        });

        jLabel40.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/componentbg.jpg"))); // NOI18N

        javax.swing.GroupLayout setScorePanelLayout = new javax.swing.GroupLayout(setScorePanel);
        setScorePanel.setLayout(setScorePanelLayout);
        setScorePanelLayout.setHorizontalGroup(
            setScorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(setScorePanelLayout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addComponent(cancelScoreButton, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                .addComponent(setScoreButton, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32))
            .addGroup(setScorePanelLayout.createSequentialGroup()
                .addGap(82, 82, 82)
                .addGroup(setScorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(scoreLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(maxScoreLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(setScorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(maxScoreTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
                    .addComponent(scoreTextField))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(setScorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(setScorePanelLayout.createSequentialGroup()
                    .addComponent(jLabel40, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );
        setScorePanelLayout.setVerticalGroup(
            setScorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(setScorePanelLayout.createSequentialGroup()
                .addGroup(setScorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(setScorePanelLayout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(scoreLabel))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, setScorePanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(scoreTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(setScorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(maxScoreTextField)
                    .addComponent(maxScoreLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(setScorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(cancelScoreButton, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(setScoreButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(68, Short.MAX_VALUE))
            .addGroup(setScorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(setScorePanelLayout.createSequentialGroup()
                    .addComponent(jLabel40, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );

        setScoreFrame.getContentPane().add(setScorePanel);
        setScorePanel.setBounds(0, 0, 330, 200);

        alarmDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        alarmDialog.setAlwaysOnTop(true);
        alarmDialog.getContentPane().setLayout(null);

        alarmTitle.setFont(new java.awt.Font("Tw Cen MT", 0, 36)); // NOI18N
        alarmTitle.setText("Title");

        alarmTime.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
        alarmTime.setText("AlarmTime");

        alarmTimeFrom.setFont(new java.awt.Font("Miriam Fixed", 0, 14)); // NOI18N
        alarmTimeFrom.setText("TimeStart");

        alarmClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/save.png"))); // NOI18N
        alarmClose.setText("Ok");
        alarmClose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                alarmCloseActionPerformed(evt);
            }
        });

        jLabel41.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/4comp.jpg"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(alarmTime, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(alarmTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(70, 70, 70)
                .addComponent(alarmTimeFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(380, 380, 380)
                .addComponent(alarmClose, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(jLabel41, javax.swing.GroupLayout.PREFERRED_SIZE, 520, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(alarmTime, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addComponent(alarmTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(alarmTimeFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addComponent(alarmClose, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(jLabel41, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        alarmDialog.getContentPane().add(jPanel1);
        jPanel1.setBounds(0, 0, 520, 330);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMaximumSize(new java.awt.Dimension(900, 460));
        setMinimumSize(new java.awt.Dimension(900, 460));
        setPreferredSize(new java.awt.Dimension(900, 460));
        setResizable(false);

        mainPanel.setBackground(new java.awt.Color(153, 153, 153));
        mainPanel.setPreferredSize(new java.awt.Dimension(925, 560));

        topPanel.setLayout(null);

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/UIfinalbanner.jpg"))); // NOI18N
        topPanel.add(jLabel3);
        jLabel3.setBounds(-10, -10, 950, 160);

        leftPanel.setMaximumSize(new java.awt.Dimension(120, 424));
        leftPanel.setMinimumSize(new java.awt.Dimension(120, 424));
        leftPanel.setLayout(new java.awt.CardLayout());

        eventsButtonsPanel.setLayout(null);

        addEventButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/eventview.png"))); // NOI18N
        addEventButton.setToolTipText("Add Event");
        addEventButton.setMaximumSize(new java.awt.Dimension(110, 23));
        addEventButton.setMinimumSize(new java.awt.Dimension(110, 23));
        addEventButton.setPreferredSize(new java.awt.Dimension(110, 23));
        addEventButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addEventButtonActionPerformed(evt);
            }
        });
        eventsButtonsPanel.add(addEventButton);
        addEventButton.setBounds(20, 30, 90, 70);

        editEventButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/eventedit.png"))); // NOI18N
        editEventButton.setToolTipText("Edit Event");
        editEventButton.setMaximumSize(new java.awt.Dimension(110, 23));
        editEventButton.setMinimumSize(new java.awt.Dimension(110, 23));
        editEventButton.setPreferredSize(new java.awt.Dimension(110, 23));
        editEventButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editEventButtonActionPerformed(evt);
            }
        });
        eventsButtonsPanel.add(editEventButton);
        editEventButton.setBounds(20, 130, 90, 60);

        viewEventButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/eventadd.png"))); // NOI18N
        viewEventButton.setToolTipText("View Event");
        viewEventButton.setMaximumSize(new java.awt.Dimension(110, 23));
        viewEventButton.setMinimumSize(new java.awt.Dimension(110, 23));
        viewEventButton.setPreferredSize(new java.awt.Dimension(110, 23));
        viewEventButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                viewEventButtonActionPerformed(evt);
            }
        });
        eventsButtonsPanel.add(viewEventButton);
        viewEventButton.setBounds(20, 220, 90, 60);

        deleteEventButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/eventdelete.png"))); // NOI18N
        deleteEventButton.setToolTipText("Delete Event");
        deleteEventButton.setMaximumSize(new java.awt.Dimension(105, 23));
        deleteEventButton.setMinimumSize(new java.awt.Dimension(105, 23));
        deleteEventButton.setPreferredSize(new java.awt.Dimension(105, 23));
        deleteEventButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteEventButtonActionPerformed(evt);
            }
        });
        eventsButtonsPanel.add(deleteEventButton);
        deleteEventButton.setBounds(20, 310, 90, 60);

        jLabel12.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel12.setForeground(new java.awt.Color(255, 255, 255));
        jLabel12.setText("ADD EVENT");
        eventsButtonsPanel.add(jLabel12);
        jLabel12.setBounds(30, 100, 80, 10);

        jLabel11.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel11.setForeground(new java.awt.Color(255, 255, 255));
        jLabel11.setText("DELETE EVENT");
        eventsButtonsPanel.add(jLabel11);
        jLabel11.setBounds(20, 370, 100, 10);

        jLabel13.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel13.setForeground(new java.awt.Color(255, 255, 255));
        jLabel13.setText("VIEW EVENT");
        eventsButtonsPanel.add(jLabel13);
        jLabel13.setBounds(30, 280, 80, 10);

        jLabel14.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel14.setForeground(new java.awt.Color(255, 255, 255));
        jLabel14.setText("EDIT EVENT");
        eventsButtonsPanel.add(jLabel14);
        jLabel14.setBounds(30, 190, 80, 10);

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/leftpanel.jpg"))); // NOI18N
        eventsButtonsPanel.add(jLabel4);
        jLabel4.setBounds(0, -10, 140, 440);

        leftPanel.add(eventsButtonsPanel, "card2");

        coursesButtonsPanel.setLayout(null);

        addCourseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/courseadd.png"))); // NOI18N
        addCourseButton.setToolTipText("Add Course");
        addCourseButton.setIconTextGap(0);
        addCourseButton.setMaximumSize(new java.awt.Dimension(110, 23));
        addCourseButton.setMinimumSize(new java.awt.Dimension(110, 23));
        addCourseButton.setPreferredSize(new java.awt.Dimension(110, 23));
        addCourseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addCourseButtonActionPerformed(evt);
            }
        });
        coursesButtonsPanel.add(addCourseButton);
        addCourseButton.setBounds(20, 50, 90, 80);

        editCourseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/courseedit.png"))); // NOI18N
        editCourseButton.setToolTipText("Edit Course");
        editCourseButton.setMaximumSize(new java.awt.Dimension(110, 23));
        editCourseButton.setMinimumSize(new java.awt.Dimension(110, 23));
        editCourseButton.setPreferredSize(new java.awt.Dimension(110, 23));
        editCourseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editCourseButtonActionPerformed(evt);
            }
        });
        coursesButtonsPanel.add(editCourseButton);
        editCourseButton.setBounds(20, 160, 90, 75);

        deleteCourseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/coursedelete.png"))); // NOI18N
        deleteCourseButton.setToolTipText("Delete Course");
        deleteCourseButton.setMaximumSize(new java.awt.Dimension(110, 23));
        deleteCourseButton.setMinimumSize(new java.awt.Dimension(110, 23));
        deleteCourseButton.setPreferredSize(new java.awt.Dimension(110, 23));
        deleteCourseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteCourseButtonActionPerformed(evt);
            }
        });
        coursesButtonsPanel.add(deleteCourseButton);
        deleteCourseButton.setBounds(20, 270, 90, 75);

        jLabel15.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel15.setForeground(new java.awt.Color(255, 255, 255));
        jLabel15.setText("ADD COURSE");
        coursesButtonsPanel.add(jLabel15);
        jLabel15.setBounds(20, 130, 90, 15);

        jLabel16.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel16.setForeground(new java.awt.Color(255, 255, 255));
        jLabel16.setText("DELETE COURSE");
        coursesButtonsPanel.add(jLabel16);
        jLabel16.setBounds(10, 340, 110, 30);

        jLabel17.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel17.setForeground(new java.awt.Color(255, 255, 255));
        jLabel17.setText("EDIT COURSE");
        coursesButtonsPanel.add(jLabel17);
        jLabel17.setBounds(20, 230, 90, 30);

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/leftpanel.jpg"))); // NOI18N
        coursesButtonsPanel.add(jLabel5);
        jLabel5.setBounds(0, -20, 130, 460);

        leftPanel.add(coursesButtonsPanel, "card2");

        archiveButtonsPanel.setLayout(null);

        viewEventArchiveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/archiveview event.png"))); // NOI18N
        viewEventArchiveButton.setToolTipText("View Event");
        viewEventArchiveButton.setMaximumSize(new java.awt.Dimension(110, 23));
        viewEventArchiveButton.setMinimumSize(new java.awt.Dimension(110, 23));
        viewEventArchiveButton.setPreferredSize(new java.awt.Dimension(110, 23));
        viewEventArchiveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                viewEventArchiveButtonActionPerformed(evt);
            }
        });
        archiveButtonsPanel.add(viewEventArchiveButton);
        viewEventArchiveButton.setBounds(20, 160, 90, 75);

        deleteEventArchiveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/archivedeleteevent.png"))); // NOI18N
        deleteEventArchiveButton.setToolTipText("Delete Event");
        deleteEventArchiveButton.setMaximumSize(new java.awt.Dimension(110, 23));
        deleteEventArchiveButton.setMinimumSize(new java.awt.Dimension(110, 23));
        deleteEventArchiveButton.setPreferredSize(new java.awt.Dimension(110, 23));
        deleteEventArchiveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteEventArchiveButtonActionPerformed(evt);
            }
        });
        archiveButtonsPanel.add(deleteEventArchiveButton);
        deleteEventArchiveButton.setBounds(20, 270, 90, 75);

        setScoreArchiveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/archivesetscore.png"))); // NOI18N
        setScoreArchiveButton.setToolTipText("Set Score");
        setScoreArchiveButton.setMaximumSize(new java.awt.Dimension(110, 23));
        setScoreArchiveButton.setMinimumSize(new java.awt.Dimension(110, 23));
        setScoreArchiveButton.setPreferredSize(new java.awt.Dimension(110, 23));
        setScoreArchiveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                setScoreArchiveButtonActionPerformed(evt);
            }
        });
        archiveButtonsPanel.add(setScoreArchiveButton);
        setScoreArchiveButton.setBounds(20, 50, 90, 75);

        jLabel8.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel8.setForeground(new java.awt.Color(255, 255, 255));
        jLabel8.setText("VIEW EVENT");
        archiveButtonsPanel.add(jLabel8);
        jLabel8.setBounds(30, 230, 80, 20);

        jLabel9.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel9.setForeground(new java.awt.Color(255, 255, 255));
        jLabel9.setText("DELETE EVENT");
        archiveButtonsPanel.add(jLabel9);
        jLabel9.setBounds(18, 340, 92, 20);

        jLabel10.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 12)); // NOI18N
        jLabel10.setForeground(new java.awt.Color(255, 255, 255));
        jLabel10.setText("SET SCORE");
        archiveButtonsPanel.add(jLabel10);
        jLabel10.setBounds(30, 120, 80, 20);

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/leftpanel.jpg"))); // NOI18N
        archiveButtonsPanel.add(jLabel6);
        jLabel6.setBounds(0, -10, 130, 430);

        leftPanel.add(archiveButtonsPanel, "card2");

        rightPanel.setLayout(null);

        eventsButton.setText("Events");
        eventsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventsButtonActionPerformed(evt);
            }
        });
        rightPanel.add(eventsButton);
        eventsButton.setBounds(10, 10, 90, 30);

        coursesButton.setText("Courses");
        coursesButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                coursesButtonActionPerformed(evt);
            }
        });
        rightPanel.add(coursesButton);
        coursesButton.setBounds(110, 10, 90, 30);

        archiveButton.setText("Archive");
        archiveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                archiveButtonActionPerformed(evt);
            }
        });
        rightPanel.add(archiveButton);
        archiveButton.setBounds(678, 10, 80, 30);

        centerPanelCourse.setBackground(new java.awt.Color(204, 204, 255));
        centerPanelCourse.setPreferredSize(new java.awt.Dimension(0, 350));

        activityPanel.setLayout(new java.awt.CardLayout());

        eventsPanel.setBackground(new java.awt.Color(153, 153, 153));

        todayList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        todayList.setMaximumSize(new java.awt.Dimension(33, 100));
        todayList.setMinimumSize(new java.awt.Dimension(33, 100));
        todayList.setPreferredSize(new java.awt.Dimension(33, 100));
        listPane.setViewportView(todayList);

        upcomingEventsLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/upcoming events.jpg"))); // NOI18N

        javax.swing.GroupLayout eventsPanelLayout = new javax.swing.GroupLayout(eventsPanel);
        eventsPanel.setLayout(eventsPanelLayout);
        eventsPanelLayout.setHorizontalGroup(
            eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(eventsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, 397, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(eventsPanelLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(listPane)
                        .addContainerGap())
                    .addGroup(eventsPanelLayout.createSequentialGroup()
                        .addGap(41, 41, 41)
                        .addComponent(upcomingEventsLabel)
                        .addContainerGap(42, Short.MAX_VALUE))))
        );
        eventsPanelLayout.setVerticalGroup(
            eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(eventsPanelLayout.createSequentialGroup()
                .addContainerGap(15, Short.MAX_VALUE)
                .addGroup(eventsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jCalendar1, javax.swing.GroupLayout.PREFERRED_SIZE, 294, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(eventsPanelLayout.createSequentialGroup()
                        .addComponent(upcomingEventsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(listPane, javax.swing.GroupLayout.PREFERRED_SIZE, 269, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        activityPanel.add(eventsPanel, "card2");

        coursesPanel.setBackground(new java.awt.Color(51, 51, 51));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/courses.jpg"))); // NOI18N

        coursePane.setViewportView(courseList);

        javax.swing.GroupLayout coursesPanelLayout = new javax.swing.GroupLayout(coursesPanel);
        coursesPanel.setLayout(coursesPanelLayout);
        coursesPanelLayout.setHorizontalGroup(
            coursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(coursesPanelLayout.createSequentialGroup()
                .addGroup(coursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(coursesPanelLayout.createSequentialGroup()
                        .addGap(248, 248, 248)
                        .addComponent(jLabel1))
                    .addGroup(coursesPanelLayout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(coursePane, javax.swing.GroupLayout.PREFERRED_SIZE, 682, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(21, Short.MAX_VALUE))
        );
        coursesPanelLayout.setVerticalGroup(
            coursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(coursesPanelLayout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(coursePane, javax.swing.GroupLayout.PREFERRED_SIZE, 273, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(25, Short.MAX_VALUE))
        );

        activityPanel.add(coursesPanel, "card2");

        archivePanel.setBackground(new java.awt.Color(153, 153, 153));

        archivePane.setViewportView(archiveList);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/archive.jpg"))); // NOI18N

        javax.swing.GroupLayout archivePanelLayout = new javax.swing.GroupLayout(archivePanel);
        archivePanel.setLayout(archivePanelLayout);
        archivePanelLayout.setHorizontalGroup(
            archivePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(archivePanelLayout.createSequentialGroup()
                .addGroup(archivePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(archivePanelLayout.createSequentialGroup()
                        .addGap(254, 254, 254)
                        .addComponent(jLabel2))
                    .addGroup(archivePanelLayout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(archivePane, javax.swing.GroupLayout.PREFERRED_SIZE, 685, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(24, Short.MAX_VALUE))
        );
        archivePanelLayout.setVerticalGroup(
            archivePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(archivePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(archivePane, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
                .addContainerGap())
        );

        activityPanel.add(archivePanel, "card2");

        javax.swing.GroupLayout centerPanelCourseLayout = new javax.swing.GroupLayout(centerPanelCourse);
        centerPanelCourse.setLayout(centerPanelCourseLayout);
        centerPanelCourseLayout.setHorizontalGroup(
            centerPanelCourseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(activityPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        centerPanelCourseLayout.setVerticalGroup(
            centerPanelCourseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(activityPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        rightPanel.add(centerPanelCourse);
        centerPanelCourse.setBounds(10, 45, 740, 330);

        jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/patchy/rightpanel.jpg"))); // NOI18N
        rightPanel.add(jLabel7);
        jLabel7.setBounds(0, -10, 800, 440);

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(topPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addComponent(leftPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rightPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 764, Short.MAX_VALUE))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addComponent(topPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(leftPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 433, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rightPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 900, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 584, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void archiveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_archiveButtonActionPerformed
        dynamicTransform(archiveButtonsPanel, archivePanel);
    }//GEN-LAST:event_archiveButtonActionPerformed

    private void coursesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_coursesButtonActionPerformed
        dynamicTransform(coursesButtonsPanel, coursesPanel);
    }//GEN-LAST:event_coursesButtonActionPerformed

    private void eventsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eventsButtonActionPerformed
        dynamicTransform(eventsButtonsPanel, eventsPanel);
    }//GEN-LAST:event_eventsButtonActionPerformed

    private void dynamicTransform(JPanel left, JPanel right) {
        leftPanel.removeAll();
        leftPanel.repaint();
        leftPanel.revalidate();
        activityPanel.removeAll();
        activityPanel.repaint();
        activityPanel.revalidate();
        
        leftPanel.add(left);
        leftPanel.repaint();
        leftPanel.revalidate();
        activityPanel.add(right);
        activityPanel.repaint();
        activityPanel.revalidate();
    }

    private void deleteEventArchiveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteEventArchiveButtonActionPerformed
        int x = root.getArchive().getEvents().indexOf(archiveList.getSelectedValue());
        root.getArchive().getEvents().remove(x);
        try {
            fileWrite = new ObjectOutputStream(new FileOutputStream("patchy.dat"));
            fileWrite.writeObject(root);
            fileWrite.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        listModelArchive.remove(archiveList.getSelectedIndex());
    }//GEN-LAST:event_deleteEventArchiveButtonActionPerformed

    private void viewEventArchiveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewEventArchiveButtonActionPerformed
        int x = root.getArchive().getEvents().indexOf(archiveList.getSelectedValue());
        Event event = root.getArchive().getEvents().get(x);
        viewArchiveEventFrame.setTitle("View Event");
        viewArchiveEventFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        viewArchiveEventFrame.setSize(430,380);
        viewArchiveEventFrame.setLocationRelativeTo(null);
        viewArchiveEventFrame.setVisible(true);
        viewTitleLabel1.setText(event.getTitle());
        viewAlarmLabel1.setText(event.getAlarm().toString());
        viewCourseLabel1.setText(event.getCourse().getTitle());
        viewFromLabel1.setText(event.getFrom().toString());
        viewToLabel1.setText(event.getTo().toString());
        viewDateLabel1.setText(event.getDate().toString());
        viewTextField1.setText(event.getDesc());
        viewScoreLabel.setText(event.getScore() + "/" + event.getScoreMax());
    }//GEN-LAST:event_viewEventArchiveButtonActionPerformed

    private void deleteCourseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteCourseButtonActionPerformed
        int x = root.getCourses().indexOf(courseList.getSelectedValue());
        root.getCourses().remove(x);
        try {
            fileWrite = new ObjectOutputStream(new FileOutputStream("patchy.dat"));
            fileWrite.writeObject(root);
            fileWrite.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        listModelCourse.remove(courseList.getSelectedIndex());
    }//GEN-LAST:event_deleteCourseButtonActionPerformed

    private void editCourseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editCourseButtonActionPerformed
        try {
            int x = root.getCourses().indexOf(courseList.getSelectedValue());
            Course course = root.getCourses().get(x);
            editCourseFrame.setTitle("Edit Course");
            editCourseFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            editCourseFrame.setSize(310,285);
            editCourseFrame.setLocationRelativeTo(null);
            editCourseFrame.setVisible(true);
            courseTitleBox1.setText(course.getCourse());
            courseDescriptiveTitle.setText(course.getTitle());
            courseTimeFrom1.setTime(new SimpleDateFormat("HH:mm:ss").parse(course.getFrom()));
            courseTimeTo1.setTime(new SimpleDateFormat("HH:mm:ss").parse(course.getTo()));
            courseDaysPicker.setValue(course.getDays());
        } catch (ParseException ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
        int y = root.getCourses().indexOf(courseList.getSelectedValue());
        Course course = root.getCourses().get(y);
        for (int i = 0; i < course.getEvents().size(); i++) {
            System.out.println(course.getGrade());
        }
        System.out.println("Testing");
    }//GEN-LAST:event_editCourseButtonActionPerformed

    private void addCourseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addCourseButtonActionPerformed
        // TODO add your handling code here:
        addCourseFrame.setTitle("Course");
        addCourseFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        addCourseFrame.setSize(310,260);
        addCourseFrame.setLocationRelativeTo(null);
        addCourseFrame.setVisible(true);
        
    }//GEN-LAST:event_addCourseButtonActionPerformed

    private void deleteEventButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteEventButtonActionPerformed
        int x = root.getEvents().indexOf(todayList.getSelectedValue());
        root.getEvents().remove(x);
        try {
            fileWrite = new ObjectOutputStream(new FileOutputStream("patchy.dat"));
            fileWrite.writeObject(root);
            fileWrite.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        listModelEvents.remove(todayList.getSelectedIndex());
    }//GEN-LAST:event_deleteEventButtonActionPerformed

    private void viewEventButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewEventButtonActionPerformed
        int x = root.getEvents().indexOf(todayList.getSelectedValue());
        Event event = root.getEvents().get(x);
        viewEventFrame.setTitle("View Event");
        viewEventFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        viewEventFrame.setSize(430,380);
        viewEventFrame.setLocationRelativeTo(null);
        viewEventFrame.setVisible(true);
        viewTitleLabel.setText(event.getTitle());
        viewAlarmLabel.setText(event.getAlarm().toString());
        viewCourseLabel.setText(event.getCourse().getTitle());
        viewFromLabel.setText(event.getFrom().toString());
        viewToLabel.setText(event.getTo().toString());
        viewDateLabel.setText(event.getDate().toString());
        viewTextField.setText(event.getDesc());
    }//GEN-LAST:event_viewEventButtonActionPerformed

    private void editEventButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editEventButtonActionPerformed
        try {
            int x = root.getEvents().indexOf(todayList.getSelectedValue());
            Event event = root.getEvents().get(x);
            editEventFrame.setTitle("Edit Event");
            editEventFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            editEventFrame.setSize(310,380);
            editEventFrame.setLocationRelativeTo(null);
            editEventFrame.setVisible(true);
            eventTitleText1.setText(event.getTitle());
            eventCoursePicker1.setSelectedItem(event.getCourse());
            timeFrom1.setTime(new SimpleDateFormat("HH:mm:ss").parse(event.getFrom()));
            timeTo1.setTime(new SimpleDateFormat("HH:mm:ss").parse(event.getTo()));
            eventDatePicker1.setDate(event.getDate());
            timeAlarm1.setTime(new SimpleDateFormat("HH:mm:ss").parse(event.getAlarm()));
            eventDescriptionArea1.setText(event.getDesc());
        } catch (ParseException ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_editEventButtonActionPerformed

    private void addEventButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addEventButtonActionPerformed
        addEventFrame.setTitle("Event");
        addEventFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        addEventFrame.setSize(310,380);
        addEventFrame.setLocationRelativeTo(null);
        addEventFrame.setVisible(true);
    }//GEN-LAST:event_addEventButtonActionPerformed

    private void cancelCourseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelCourseButtonActionPerformed
        addCourseFrame.dispose();
    }//GEN-LAST:event_cancelCourseButtonActionPerformed

    private void adderCourseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adderCourseButtonActionPerformed
        Course course = new Course(courseTitleBox.getText(), courseDescriptiveTitle.getText(),
            courseTimeFrom.getFormatedTime(),
            courseTimeTo.getFormatedTime(),
            courseDaysPicker.getValue().toString());
        root.getCourses().add(course);
        try {
            fileWrite = new ObjectOutputStream(new FileOutputStream("patchy.dat"));
            fileWrite.writeObject(root);
            fileWrite.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        courses.add(root.getCourses().get(root.getCourses().size() - 1));
        eventCoursePicker.setModel(new javax.swing.DefaultComboBoxModel(courses.toArray()));
        addCourseFrame.dispose();
        refreshListModelCourses();
    }//GEN-LAST:event_adderCourseButtonActionPerformed

    private void closeViewEventActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeViewEventActionPerformed
        viewEventFrame.dispose();
    }//GEN-LAST:event_closeViewEventActionPerformed

    private void editViewEventActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editViewEventActionPerformed
        viewEventFrame.dispose();
        try {
            int x = root.getEvents().indexOf(todayList.getSelectedValue());
            Event event = root.getEvents().get(x);
            editEventFrame.setTitle("Edit Event");
            editEventFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            editEventFrame.setSize(310,380);
            editEventFrame.setLocationRelativeTo(null);
            editEventFrame.setVisible(true);
            eventTitleText1.setText(event.getTitle());
            eventCoursePicker1.setSelectedItem(event.getCourse());
            timeFrom1.setTime(new SimpleDateFormat("HH:mm:ss").parse(event.getFrom()));
            timeTo1.setTime(new SimpleDateFormat("HH:mm:ss").parse(event.getTo()));
            eventDatePicker1.setDate(event.getDate());
            timeAlarm1.setTime(new SimpleDateFormat("HH:mm:ss").parse(event.getAlarm()));
            eventDescriptionArea1.setText(event.getDesc());
        } catch (ParseException ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_editViewEventActionPerformed

    private void cancelEventButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelEventButtonActionPerformed
        addEventFrame.dispose();
    }//GEN-LAST:event_cancelEventButtonActionPerformed

    private void adderEventButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adderEventButtonActionPerformed
        Event event = new Event(eventTitleText.getText(),
            (Course) eventCoursePicker.getSelectedItem(),
            timeFrom.getFormatedTime(),
            timeTo.getFormatedTime(),
            eventDatePicker.getDate(),
            timeAlarm.getFormatedTime(),
            eventDescriptionArea.getText());
        root.getEvents().add(event);
        
        System.out.println(root.getEvents().get(root.getEvents().size() - 1));
        addEventFrame.dispose();

        try {
            fileWrite = new ObjectOutputStream(new FileOutputStream("patchy.dat"));
            fileWrite.writeObject(root);
            fileWrite.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        refreshListModelEvents();
    }//GEN-LAST:event_adderEventButtonActionPerformed

    private void cancelEventButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelEventButton1ActionPerformed
        editEventFrame.dispose();
    }//GEN-LAST:event_cancelEventButton1ActionPerformed

    private void saveEditEventButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveEditEventButtonActionPerformed
        int x = root.getEvents().indexOf(todayList.getSelectedValue());
        root.getEvents().remove(x);
        listModelEvents.remove(todayList.getSelectedIndex());
        root.getEvents().add(new Event(eventTitleText1.getText(),
            (Course) eventCoursePicker1.getSelectedItem(),
            timeFrom1.getFormatedTime(),
            timeTo1.getFormatedTime(),
            eventDatePicker1.getDate(),
            timeAlarm1.getFormatedTime(),
            eventDescriptionArea1.getText()));
        try {
            fileWrite = new ObjectOutputStream(new FileOutputStream("patchy.dat"));
            fileWrite.writeObject(root);
            fileWrite.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        editEventFrame.dispose();
        refreshListModelEvents();
    }//GEN-LAST:event_saveEditEventButtonActionPerformed

    private void alarmCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_alarmCloseActionPerformed
        if(root.getEvents().size() != 1 && root.getEvents().size() != 0) {
            Event event = root.getEvents().get(1);
            alarmHour = Integer.parseInt(event.getAlarm().substring(0, 2));
            alarmMinute = Integer.parseInt(event.getAlarm().substring(3, 5));
        } else {
            alarmHour = -1;
            alarmMinute = -1;
        }
        
        alert = false;
        alarmDialog.dispose();
    }//GEN-LAST:event_alarmCloseActionPerformed

    private void cancelCourseButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelCourseButton1ActionPerformed
        editCourseFrame.dispose();
    }//GEN-LAST:event_cancelCourseButton1ActionPerformed

    private void courseEditSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_courseEditSaveActionPerformed
        int x = root.getCourses().indexOf(courseList.getSelectedValue());
        root.getCourses().remove(x);
        root.getCourses().add(new Course(courseTitleBox1.getText(),
            courseDescriptiveTitle1.getText(), courseTimeFrom1.getFormatedTime(),
            courseTimeTo1.getFormatedTime(), courseDaysPicker.getValue().toString()));
        try {
            fileWrite = new ObjectOutputStream(new FileOutputStream("patchy.dat"));
            fileWrite.writeObject(root);
            fileWrite.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        editCourseFrame.dispose();
        refreshListModelCourses();
    }//GEN-LAST:event_courseEditSaveActionPerformed

    private void closeViewEvent1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeViewEvent1ActionPerformed
        viewArchiveEventFrame.dispose();
    }//GEN-LAST:event_closeViewEvent1ActionPerformed

    private void setScoreArchiveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setScoreArchiveButtonActionPerformed
        int x = root.getArchive().getEvents().indexOf(archiveList.getSelectedValue());
        Event event = root.getArchive().getEvents().get(x);
        setScoreFrame.setTitle("Set Score");
        setScoreFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setScoreFrame.setSize(330,185);
        setScoreFrame.setLocationRelativeTo(null);
        setScoreFrame.setVisible(true);
        scoreTextField.setText(event.getScore() + "");
        maxScoreTextField.setText(event.getScoreMax() + ""); 
    }//GEN-LAST:event_setScoreArchiveButtonActionPerformed

    private void setScoreButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setScoreButtonActionPerformed
        int x = root.getArchive().getEvents().indexOf(archiveList.getSelectedValue());
        int score = Integer.parseInt(scoreTextField.getText());
        int maxScore = Integer.parseInt(maxScoreTextField.getText());
        root.getArchive().getEvents().get(x).setScore(score);
        root.getArchive().getEvents().get(x).setScoreMax(maxScore);
        try {
            fileWrite = new ObjectOutputStream(new FileOutputStream("patchy.dat"));
            fileWrite.writeObject(root);
            fileWrite.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        setScoreFrame.dispose();
        refreshListModelCourses();
    }//GEN-LAST:event_setScoreButtonActionPerformed

    private void cancelScoreButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelScoreButtonActionPerformed
        setScoreFrame.dispose();
    }//GEN-LAST:event_cancelScoreButtonActionPerformed

    private void scoreTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_scoreTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_scoreTextFieldActionPerformed

    private void maxScoreTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_maxScoreTextFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_maxScoreTextFieldActionPerformed

    private void initHome() {
        refreshListModelEvents();
        refreshListModelCourses();
        refreshListModelArchive();
        courses.add(new Course("None", null, null, null, null));
        for(int x = 0; x < root.getCourses().size(); x++) {
            courses.add(root.getCourses().get(x));
            courseTable[x] = root.getCourses().get(x).toCourseTableArray();
        }
    }
    
    private void refreshListModelEvents() {
        Collections.sort(root.getEvents());
        Event comingEvent;
        if (root.getEvents().size() != 0) {
            comingEvent = root.getEvents().get(0);
            alarmHour = Integer.parseInt(comingEvent.getAlarm().substring(0, 2));
            alarmMinute = Integer.parseInt(comingEvent.getAlarm().substring(3, 5));
            eventHour = Integer.parseInt(comingEvent.getFrom().substring(0, 2));
            eventMinute = Integer.parseInt(comingEvent.getFrom().substring(3, 5));
        } else {
            alarmHour = -1;
            alarmMinute = -1;
            eventHour = -1;
            eventMinute = -1;
        }
        listModelEvents.clear();
        for(int x = 0; x < root.getEvents().size(); x++) {
            listModelEvents.addElement(root.getEvents().get(x));
        }
        
    }
    
    private void refreshListModelCourses() {
        Collections.sort(root.getCourses());
        listModelCourse.clear();
        for(int x = 0; x < root.getCourses().size(); x++) {
            listModelCourse.addElement(root.getCourses().get(x));
        }
        
    }
    
    private void refreshListModelArchive() {
        Collections.sort(root.getArchive().getEvents());
        listModelArchive.clear();
        for(int x = 0; x < root.getArchive().getEvents().size(); x++) {
            listModelArchive.addElement(root.getArchive().getEvents().get(x));
        }
    }
    
    private void toArchive(Event event) {
        int x = root.getEvents().indexOf(event);
        root.getArchive().getEvents().add(event);
        root.getEvents().remove(x);
        event.getCourse().addEvent(event);
        /*int y = root.getCourses().indexOf(event.getCourse());
        int z = root.getArchive().getEvents().indexOf(event);
        root.getCourses().get(y).addEvent(root.getArchive().getEvents().get(z));*/
        refreshListModelEvents();
        refreshListModelArchive();
    }
      
    public static void main(String args[]) {
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        (new Thread(new MainFrame())).start();
    }
    
    @Override
    public void run() {
        boolean running = true;
        int nD, nH, nM;
        // loop until the application dies
        while (running) {
            // find out what time it is
            Date d = new Date(System.currentTimeMillis());
            nD = d.getDate();
            nH = d.getHours();
            nM = d.getMinutes();
            if (alarmHour == nH && alarmMinute == nM &&
                    Integer.parseInt(root.getEvents().get(0).getDate().toString().substring(8, 10)) == nD) {
                popAlarm();
            }
            if (eventHour == nH && eventMinute == nM &&
                    Integer.parseInt(root.getEvents().get(0).getDate().toString().substring(8, 10)) == nD) {
                toArchive(root.getEvents().get(0));
                refreshListModelEvents();
            }
         }
    }
    
    private void popAlarm() {
        alarmDialog.setTitle("Event");
        alarmDialog.setSize(535,150);
        alarmDialog.setLocationRelativeTo(null);
        alarmDialog.setVisible(true);
        alarmTitle.setText(root.getEvents().get(0).getTitle());
        alarmTime.setText(root.getEvents().get(0).getAlarm());
        alarmTimeFrom.setText(root.getEvents().get(0).getFrom());
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel activityPanel;
    private javax.swing.JButton addCourseButton;
    private javax.swing.JFrame addCourseFrame;
    private javax.swing.JPanel addCoursePanel;
    private javax.swing.JPanel addCoursePanel1;
    private javax.swing.JButton addEventButton;
    private javax.swing.JFrame addEventFrame;
    private javax.swing.JPanel addEventPanel;
    private javax.swing.JPanel addEventPanel1;
    private javax.swing.JButton adderCourseButton;
    private javax.swing.JButton adderEventButton;
    private javax.swing.JButton alarmClose;
    private javax.swing.JDialog alarmDialog;
    private javax.swing.JLabel alarmTime;
    private javax.swing.JLabel alarmTimeFrom;
    private javax.swing.JLabel alarmTitle;
    private javax.swing.JButton archiveButton;
    private javax.swing.JPanel archiveButtonsPanel;
    private javax.swing.JList archiveList;
    private javax.swing.JScrollPane archivePane;
    private javax.swing.JPanel archivePanel;
    private javax.swing.JButton cancelCourseButton;
    private javax.swing.JButton cancelCourseButton1;
    private javax.swing.JButton cancelEventButton;
    private javax.swing.JButton cancelEventButton1;
    private javax.swing.JButton cancelScoreButton;
    private javax.swing.JPanel centerPanelCourse;
    private javax.swing.JButton closeViewEvent;
    private javax.swing.JButton closeViewEvent1;
    private javax.swing.JLabel course;
    private javax.swing.JLabel course1;
    private javax.swing.JLabel courseDays;
    private javax.swing.JLabel courseDays1;
    private javax.swing.JSpinner courseDaysPicker;
    private javax.swing.JSpinner courseDaysPicker1;
    private javax.swing.JTextField courseDescriptiveTitle;
    private javax.swing.JTextField courseDescriptiveTitle1;
    private javax.swing.JButton courseEditSave;
    private javax.swing.JLabel courseFrom;
    private javax.swing.JLabel courseFrom1;
    private javax.swing.JList courseList;
    private javax.swing.JScrollPane coursePane;
    private lu.tudor.santec.jtimechooser.JTimeChooser courseTimeFrom;
    private lu.tudor.santec.jtimechooser.JTimeChooser courseTimeFrom1;
    private lu.tudor.santec.jtimechooser.JTimeChooser courseTimeTo;
    private lu.tudor.santec.jtimechooser.JTimeChooser courseTimeTo1;
    private javax.swing.JLabel courseTitle;
    private javax.swing.JLabel courseTitle1;
    private javax.swing.JTextField courseTitleBox;
    private javax.swing.JTextField courseTitleBox1;
    private javax.swing.JLabel courseTo;
    private javax.swing.JLabel courseTo1;
    private javax.swing.JButton coursesButton;
    private javax.swing.JPanel coursesButtonsPanel;
    private javax.swing.JPanel coursesPanel;
    private javax.swing.JButton deleteCourseButton;
    private javax.swing.JButton deleteEventArchiveButton;
    private javax.swing.JButton deleteEventButton;
    private javax.swing.JButton editCourseButton;
    private javax.swing.JFrame editCourseFrame;
    private javax.swing.JButton editEventButton;
    private javax.swing.JFrame editEventFrame;
    private javax.swing.JButton editViewEvent;
    private javax.swing.JLabel eventAlarm;
    private javax.swing.JLabel eventAlarm1;
    private javax.swing.JLabel eventCourse;
    private javax.swing.JLabel eventCourse1;
    private javax.swing.JComboBox eventCoursePicker;
    private javax.swing.JComboBox eventCoursePicker1;
    private javax.swing.JLabel eventDate;
    private javax.swing.JLabel eventDate1;
    private com.toedter.calendar.JDateChooser eventDatePicker;
    private com.toedter.calendar.JDateChooser eventDatePicker1;
    private javax.swing.JLabel eventDescription;
    private javax.swing.JLabel eventDescription1;
    private javax.swing.JTextArea eventDescriptionArea;
    private javax.swing.JTextArea eventDescriptionArea1;
    private javax.swing.JLabel eventFrom;
    private javax.swing.JLabel eventFrom1;
    private javax.swing.JLabel eventTitle;
    private javax.swing.JLabel eventTitle1;
    private javax.swing.JTextField eventTitleText;
    private javax.swing.JTextField eventTitleText1;
    private javax.swing.JLabel eventTo;
    private javax.swing.JLabel eventTo1;
    private javax.swing.JButton eventsButton;
    private javax.swing.JPanel eventsButtonsPanel;
    private javax.swing.JPanel eventsPanel;
    private com.toedter.calendar.JCalendar jCalendar1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JPanel leftPanel;
    private javax.swing.JScrollPane listPane;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JLabel maxScoreLabel;
    private javax.swing.JTextField maxScoreTextField;
    private javax.swing.JPanel rightPanel;
    private javax.swing.JButton saveEditEventButton;
    private javax.swing.JLabel scoreLabel;
    private javax.swing.JTextField scoreTextField;
    private javax.swing.JButton setScoreArchiveButton;
    private javax.swing.JButton setScoreButton;
    private javax.swing.JFrame setScoreFrame;
    private javax.swing.JPanel setScorePanel;
    private lu.tudor.santec.jtimechooser.JTimeChooser timeAlarm;
    private lu.tudor.santec.jtimechooser.JTimeChooser timeAlarm1;
    private lu.tudor.santec.jtimechooser.JTimeChooser timeFrom;
    private lu.tudor.santec.jtimechooser.JTimeChooser timeFrom1;
    private lu.tudor.santec.jtimechooser.JTimeChooser timeTo;
    private lu.tudor.santec.jtimechooser.JTimeChooser timeTo1;
    private javax.swing.JList todayList;
    private javax.swing.JPanel topPanel;
    private javax.swing.JLabel upcomingEventsLabel;
    private javax.swing.JLabel viewAlarmLabel;
    private javax.swing.JLabel viewAlarmLabel1;
    private javax.swing.JFrame viewArchiveEventFrame;
    private javax.swing.JLabel viewCourseLabel;
    private javax.swing.JLabel viewCourseLabel1;
    private javax.swing.JLabel viewDateLabel;
    private javax.swing.JLabel viewDateLabel1;
    private javax.swing.JButton viewEventArchiveButton;
    private javax.swing.JButton viewEventButton;
    private javax.swing.JFrame viewEventFrame;
    private javax.swing.JPanel viewEventPanel;
    private javax.swing.JPanel viewEventPanel1;
    private javax.swing.JLabel viewFromLabel;
    private javax.swing.JLabel viewFromLabel1;
    private javax.swing.JLabel viewScoreLabel;
    private javax.swing.JTextField viewTextField;
    private javax.swing.JTextField viewTextField1;
    private javax.swing.JLabel viewTitleLabel;
    private javax.swing.JLabel viewTitleLabel1;
    private javax.swing.JLabel viewToLabel;
    private javax.swing.JLabel viewToLabel1;
    // End of variables declaration//GEN-END:variables
}
